package com.etone.uds;

import cn.hutool.core.util.XmlUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.etone.uds.webservice.BizAdaptor;
import com.etone.uds.webservice.BizAdaptorService;
import com.etone.uds.webservice.BizAdaptorServiceLocator;
import com.etone.uds.webservice.bean.QueryEmployeeDTO;
import org.w3c.dom.Document;

import javax.xml.rpc.ServiceException;

public class Test {
    public static void main(String[] args) throws Exception {
        BizAdaptorService service = new BizAdaptorServiceLocator();
        BizAdaptor bizAdaptor = service.getBizService();
//        java.lang.String packageName, java.lang.String unitID, java.lang.String automata, java.lang.String password, java.lang.String inputXML
        String packageName = "webservice";
        String automata = "false";
        String unitID = "0";
        String password = "1";
        String inputXml = getinputXml();

        String employee = bizAdaptor.bizQueryEmpChgHistory(packageName, unitID, automata, password, inputXml);
        System.out.println(employee);
//        System.out.println(inputXml);
    }

    private static String getinputXml() {
        /***
         * APPID：b902cb1031e5446e9233de47648575e0
         * 密码  ：GMCCSJZT
         *   全量数据logid  接口数据：
         *   用户#200001-516665；
         *   组织#600001-748922；
         *
         *   全量抽取后，更新数据logid节点
         *   用户：5051688
         *   组织：1529088
         * 测试环境ip:10.251.147.187:7001
         */
        String rs = " <inputXML xsi:type=\"xsd:string\"><![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
                "<root>\n" +
                "\t\t\t\t<data>\n" +
                "\t\t\t\t<APPLICATION>\n" +
                "\t\t\t\t<APPID>b902cb1031e5446e9233de47648575e0</APPID>\n" +
                "\t\t\t\t<WEBSERVICEPWD>GMCCSJZT</WEBSERVICEPWD>\n" +
                "\t\t\t\t</APPLICATION>\n" +
                "\t\t\t\t<EOSORG_T_EMPLOYEE_LOG>\n" +
                "\t\t\t\t<logID>200011:200021</logID>\n" +
                "\t\t\t\t</EOSORG_T_EMPLOYEE_LOG>\n" +
                "\t\t\t\t</data>\n" +
                "\t\t\t\t</root>\n" +
                "         ]]></inputXML>";
        return rs;
//        QueryEmployeeDTO dto = new QueryEmployeeDTO();
//        JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
//        Document xml = XmlUtil.mapToXml(json, "root");
//        System.out.println(xml.toString());
//        return xml.toString();
    }
}
